/*
 * Copyright the original author or authors.
 * 
 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.pixlib.sfe.event 
{
	import net.pixlib.events.BasicEvent;

	import flash.events.Event;

	/**
	 * @author Romain Ecarnot
	 */
	public class LibraryEvent extends BasicEvent 
	{
		//--------------------------------------------------------------------
		// Event types
		//--------------------------------------------------------------------
		
		/**
		 * Defines the value of the <code>type</code> property of the event 
		 * object for a <code>onLibraryChanged</code> event.
		 * 
		 * <p>The properties of the event object have the following values:</p>
	     * <table class="innertable">
	     *     <tr><th>Property</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>type</code></td>
	     *     	<td>Dispatched event type</td>
	     *     </tr>
	     *     
	     *     <tr><th>Method</th><th>Value</th></tr>
	     *     <tr>
	     *     	<td><code>getFontList()</code>
	     *     	</td><td>FontProperties list</td>
	     *     </tr>
	     * </table>
	     * 
		 * @eventType onLibraryChanged
		 */
		public static const onLibraryChangedEVENT : String = "onLibraryChanged";
		
				
		//--------------------------------------------------------------------
		// Public API
		//--------------------------------------------------------------------
		
		/**
		 * Creates a new <code>LibraryEvent</code> instance.
		 * 
		 * @param	type		name of the event type
		 * @param	fontList	target of this event
		 */
		public function LibraryEvent(eventType : String, fontList : Array)
		{
			super(eventType, fontList);
		}
		
		/**
		 * Returns the font list array carried by event.
		 * 
		 * @return	the the font list array carried by event.
		 */
		public function getFontList() : Array
		{
			return getTarget() as Array;
		}
		
		/**
		 * Clone the event.
		 * 
		 * @return	a clone of the event
		 */
		override public function clone() : Event
		{
			return new LibraryEvent(type, getFontList());
		}
	}
}
